package com.fingard.dsp.bank.reqrespobj.frgcurrsinglecheck;

import java.math.BigDecimal;

import com.fingard.dsp.bank.reqrespobj.ReqRespHeader;
import com.fingard.dsp.bank.reqrespobj.RequestBase;
import com.fingard.dsp.bank.reqrespobj.frgcurrsinglecheck.detail.CJFrgCurrCheckDetail;
import com.fingard.xml.XmlTextReader;

public class ReqCJFrgCurrCheck extends RequestBase {
    public String totalAmt = "";
    public String reqBatchNO = "";//批次号，跟ATS数据库字段保持一致
    public String recordNum ="";//记录条数

    private XmlTextReader xmlReader;
    public ReqCJFrgCurrCheck(XmlTextReader p_xmlReader, ReqRespHeader p_header) throws Exception{
        reqHeader = p_header;
        xmlReader = p_xmlReader;
        reqBatchNO=xmlReader.getSimpleText("ReqBatchNO");
        recordNum=xmlReader.getSimpleText("RecordNum");
    }

    public CJFrgCurrCheckDetail readedDetail;//复用singlepay.detail.ReqPayRecDetail

    public boolean readRecord() throws Exception{
        readedDetail = null;
        if(xmlReader.read(PATH_Detail)){
            readedDetail = new CJFrgCurrCheckDetail(xmlReader.readedXElement);
            return true;
        }
        else{
            return false;
        }
    }

    public int getTotalNum(){
        return Integer.parseInt(recordNum);
    }

    public BigDecimal getTotalAmt(){
        return new BigDecimal(totalAmt);
    }
}
